﻿using Orleans;
using System;
using System.Collections.Generic;
using System.Text;
using System.Threading.Tasks;

namespace IOP.Orleans.TokenStorage
{
    /// <summary>
    /// 令牌存储节点接口
    /// </summary>
    public interface ITokenStorageGrain : IGrainWithStringKey
    {
        /// <summary>
        /// 获取令牌缓存
        /// </summary>
        /// <returns></returns>
        Task<TokenStorage> GetToken();

        /// <summary>
        /// 手动设置令牌
        /// </summary>
        /// <param name="token"></param>
        /// <returns></returns>
        Task SetToken(TokenStorage token);

        /// <summary>
        /// 手动通知令牌已经失效，并重新拉取并返回最新的令牌
        /// </summary>
        /// <returns></returns>
        Task<TokenStorage> TokenIsInvalid();
    }
}
